FROM daocloud.io/esfak47/java-node-maven:master-77d16ad

ADD . /app

RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone && \
    mv /app/settings.xml /root/.m2/settings.xml && \
    /usr/share/maven/bin/mvn clean package -f /app/pom.xml && \
    mv /app/target/cloud-favorite.jar app.jar && \
    rm -rf /usr/share/maven && \
    rm -rf /app && \
    rm -rf /root/.m2/repository && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV JAVA_OPTS="-Dfile.encoding=utf-8 -Dspring.profiles.active=prod"
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar app.jar" ]